package com.book.kafka.client.exception;

import org.springframework.kafka.listener.ListenerExecutionFailedException;

/**
 * @author GAVER
 * @create 2018-12-21 12:25
 * @desc kafka消费异常类
 *  //无需要补充触发，不关注:try啥也不干
 *  //throw new KafkaConsumerException(ex.getMessage(),ex.getCause(), KafkaConsumerException.IGNORE);
 * //需要补充触发，跳过再触发 1:post 2:throw offset+1 |有序触发 throw 自定义异常
 * throw new KafkaConsumerException(ex.getMessage(),ex.getCause(), KafkaConsumerException.CONTINUE_RESTRICT);
 **/
public class KafkaConsumerException extends ListenerExecutionFailedException {
    public static final String  IGNORE = "忽略|跳过";
    public static final String  CONTINUE_RESTRICT = "继续|严格有序";
    public static final String  CONTINUE_JUMP = "继续|跳过";
    /**
     * 异常类型
     */
    private String type;

    public KafkaConsumerException(String message, String type) {
        super(message);
        this.type = type;
    }

    public KafkaConsumerException(String message, Throwable cause, String type) {
        super(message, cause);
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
